/**
 * 
 */
package com.fdm.model.properties;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

import com.fdm.model.exceptions.BankPropertiesException;

/**
 * @author alain.brown
 *
 */
public class BankProperties {

	private final String filename;
	private Properties properties = new Properties();
	private final String storageType;
	
	public BankProperties()
	{
		this.filename = "BankTeller.properties";
		this.ReadFile(filename);
		this.storageType=properties.getProperty("STORAGE");
	}
	
	public String getStorage() throws BankPropertiesException
	{
		if (storageType!=null) return storageType;
		throw new BankPropertiesException();
	}
	
	private void ReadFile(String file)
	{
		try {
			InputStream inputStream = this.getClass().getClassLoader()  
	        .getResourceAsStream(file); 
			if (inputStream!=null) properties.load(inputStream);
		} catch (FileNotFoundException e) {

		} catch (IOException e) {

		}
	}
}
